import { Button, Form, Input, Spin } from "antd";
import TextArea from "antd/es/input/TextArea";
import { FieldType, useHomeText } from "../hooks/useHomeText";

export default function ConfigHomeText() {
  const { loading, form, btnLoading, onFinish } = useHomeText();
  return (
    <Spin spinning={loading}>
      <Form
        form={form}
        name="configHomeText"
        size="middle"
        onFinish={onFinish}
        autoComplete="off"
        layout="vertical"
      >
        <Form.Item<FieldType>
          name="title"
          label="标题"
          rules={[{ required: true, message: "请输入!" }]}
        >
          <Input />
        </Form.Item>

        <Form.Item<FieldType>
          name="printText"
          label="打印文字"
          rules={[{ required: true, message: "请输入!" }]}
        >
          <TextArea />
        </Form.Item>
        <Form.Item>
          <Button type="primary" htmlType="submit" loading={btnLoading}>
            保存
          </Button>
        </Form.Item>
      </Form>
    </Spin>
  );
}
